//
//  CHComplainListCell.m
//  CarFile
//
//  Created by 陈浩 on 2017/6/6.
//  Copyright © 2017年 陈浩. All rights reserved.
//

#import "CHComplainListCell.h"
@interface CHComplainListCell()

{
    
    UILabel *carnoLabel;         //  车牌号
    UIImageView *iconImgView;      //   头像
    UILabel *evaluatedetailsLabel;      //  用户反馈
    UILabel *valuatevalueLabel;       //  企业回复
    UIImageView *picImgView;
    UIView *bgView;
    
}
@property (nonatomic ,strong) NSMutableArray *views;
@end
@implementation CHComplainListCell
-(NSMutableArray *)views{
    
    
    if (!_views) {
        _views = [NSMutableArray array];
    }
    return _views;
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

+(instancetype)cellForTableView:(UITableView *)tableView{
    static NSString *ID = @"CHComplainListCell";
    CHComplainListCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (!cell) {
        cell = [[CHComplainListCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
    }
    return cell;
    
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self buildUI];
        
    }
    return self;
    
}

-(void)buildUI{
    
    iconImgView = [[UIImageView alloc] init];
    iconImgView.image = [UIImage imageNamed:@"home_icon_1"];
    [self.contentView addSubview:iconImgView];
    
    carnoLabel = [[UILabel alloc] init];
    carnoLabel.text = @"浙A4JW98";
    carnoLabel.font =[UIFont systemFontOfSize:14];
    [self.contentView addSubview:carnoLabel];
    
    
    evaluatedetailsLabel = [[UILabel alloc] init];
    evaluatedetailsLabel.numberOfLines = 0;
    evaluatedetailsLabel.font = [UIFont systemFontOfSize:14];
    [self.contentView addSubview:evaluatedetailsLabel];
    
    for (int i = 0; i < 3; i++) {
        picImgView = [[UIImageView alloc] init];
        picImgView.image = [UIImage imageNamed:@"show"];
        [self.views addObject:picImgView];
        [self.contentView addSubview:picImgView];
    }
    
    bgView = [[UIView alloc] init];
    bgView.backgroundColor = [UIColor colorWithRed:244/255.0 green:244/255.0 blue:244/255.0 alpha:1.0f];
    [self.contentView addSubview:bgView];
    
    valuatevalueLabel = [[UILabel alloc] init];
    valuatevalueLabel.textColor = [UIColor colorWithHexString:@"888888" alpha:1.0f];
    valuatevalueLabel.font = [UIFont systemFontOfSize:12];
    valuatevalueLabel.numberOfLines = 0;
    [bgView addSubview:valuatevalueLabel];
    
    
}

-(void)setComplainListFrm:(CHComplainListFrame *)complainListFrm{
    _complainListFrm = complainListFrm;
    
    [self settingData];
    
    [self settingFrame];
}



-(void)settingData{
    
    CHComplainListModel *model = self.complainListFrm.model;
    evaluatedetailsLabel.text = model.evaluatedetails;
    valuatevalueLabel.text =  [NSString stringWithFormat:@"企业回复：%@",model.valuatevalue];
}

-(void)settingFrame{
    
    iconImgView.frame = self.complainListFrm.iconFrm;
//    carnoLabel.frame = self.complainListFrm.carnoFrm;
    evaluatedetailsLabel.frame = self.complainListFrm.evaluatedetailsFrm;
    for (int i = 0; i < 3; i++) {
        picImgView = self.views[i];
        picImgView.frame = [self.complainListFrm.picFrms[i] CGRectValue];
    }
    bgView.frame = self.complainListFrm.bgViewFrm;
    valuatevalueLabel.frame = self.complainListFrm.valuatevalueFrm;
    
}

@end
